<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return $router->app->version();
});
$router->get('/example','ExampleController@test');

$router->get('/test',function(){
   $time = strtotime(date("Y-m-d",intval(time())));
    echo date("Y-m-d",$time);
    var_dump($time);
});
//获取七牛uploadToken
$router->get('/getQiniuToken','QiniuController@getQiniuToken');

//后台路由组
$router->group(['namespace' => 'Admin'], function() use ($router){
//    Route::get('test','Predis\Profile\RedisProfile@')
//    redis 排行榜测试
    Route::get('redisRankTest','TestRedisController@rank');
    //用户
//    $router->resource('user',"UserController");
    $router->get('user',"UserController@index");
    $router->post('addUser',"UserController@store"); //添加系统用户的地址
    $router->post('updateUser/{id}',"UserController@update"); //修改系统用户的地址
    $router->get('useraa',"UserController@useraa");
    $router->get('getAdminUsers','UserController@getAdminUsers');
    $router->post('banUser','UserController@banUser'); //封号与解封

    //分析
    Route::get('refreshDayUserNum','AnalysisController@refreshDayUserNum');//刷新每日新增用户数
    Route::get('getDayUserNum','AnalysisController@getDayUserNum');//获取每日新增用户数
    Route::get('refreshSexNum','AnalysisController@refreshSexNumFromDB');//刷新男女用户数和用户总数
    Route::get('getSexNum','AnalysisController@getSexNum'); //获取男女用户数和用户总数

    Route::get('refreshDayUserNum','AnalysisController@refreshDayUserNum');//刷新每日新增图片数
    Route::get('getDayPictureNum','AnalysisController@getDayPictureNum');//获取每日新增图片数
    Route::get('refreshDayPictureNum','AnalysisController@refreshDayPictureNum');//刷新每天图片数量
    Route::get('getPictureNum','AnalysisController@getPictureNum'); //获取图片数量


    Route::get('getCategoriesPerdayNum','AnalysisController@getCategoriesPerdayNum'); //获取各分组每日增加图片
    Route::get('addCategoriesPerdayNum','AnalysisController@addCategoriesPerdayNum'); //模拟增加各分组每日增加图片

    Route::get('getAll','AnalysisController@getAll'); //获取所有记录
    Route::get('clearAll','AnalysisController@clearAll'); //清空所有记录
    Route::get('refreshAll','AnalysisController@refreshAll'); //刷新所有记录
//    图片
//    Route::resource('picture',"PictureController");
    Route::post('addPicture','PictureController@store');//保存图片
    Route::get('getPicture','PictureController@index');//获取图片
    Route::post('checkPicture','PictureController@check');
    Route::get('getManagePictures','PictureController@getManagePictures');//管理获取图片
    Route::post('pictureCategoryChange','PictureController@pictureCategoryChange');//管理获取图片
    Route::post('delPicture','PictureController@delPicture');//删除图片

    //等级管理路由
//    Route::resource('rank',"RankController");
    Route::post('addRank',"RankController@store");
    Route::get('getUserRank',"RankController@getUserRank"); //获取用户等级列表
    Route::get('getPictureRank',"RankController@getPictureRank"); //获取图片等级列表
    Route::post('updateRank',"RankController@update"); //更新等级信息
    Route::post('delRankupdateRank',"RankController@destroy"); //更新等级信息

    //分组路由
//    Route::resource('group',"CategoryController");
    Route::get('getCategory','CategoryController@index');
    Route::post('addCategory','CategoryController@store');
    Route::post('changeCategoryStatus',"CategoryController@changeCategoryStatus");//改变分组状态
    Route::post('delCategory',"CategoryController@destroy");//删除分组
//    分组类型路由
    Route::get('getCategorysType','CategorysTypeController@index');//获取分组类型
    Route::post('addCategorysType','CategorysTypeController@store');//添加分组类型
//    Route::post('delCategoryType','CategorysTypeController@destroy');//分组类型删除

//设置
    Route::get('blood','SettingController@blood');
    Route::get('maxBlood','SettingController@maxBlood');
    Route::get('ticket','SettingController@ticket');
    Route::get('addPictureBlood','SettingController@addPictureBlood');
    Route::get('addUserTicket','SettingController@addUserTicket');
    Route::get('banHistoryTime','SettingController@banHistoryTime');

//    用户反馈
    Route::get('feedbackUserList','FeedbackController@index');
});


//小程序路由组
$router->group(['namespace' => 'Api','prefix' => 'api'], function() use ($router) {
    $router->get('/users',function(){return 111;});
//用户
    $router->post('login', 'LoginController@login');//登录
    $router->post('register', 'LoginController@register');//注册
    $router->post('getOpenId', 'LoginController@getOpenId');//获取用户openID
    $router->post('updateUser', 'LoginController@update');//更新

//图片
    $router->post('uploadPicture', 'PictureController@upload');//上传图片
    $router->post('quitMatch', 'PictureController@quitMatch');//暂时退赛
    $router->post('addHealthPoint', 'PictureController@addHealthPoint');//增加血量

//比赛
    $router->get('getMatchPicture', 'MatchController@getPictrue');//获取比赛的图片
    $router->post('postMatchPicture', 'MatchController@postPicture');//上传比赛结果
    $router->get('clearUserMatchRdis', 'MatchController@clearUserMatchRdis');//清空服务器的redis用户的图片id缓冲
//升级
    $router->get('upgrade', 'MatchController@userUpgrade');//升级测试

//用户
    $router->get('getUsersPicture', 'UserController@getUsersPicture');//获取用户的图片
    $router->get('addTicket', 'UserController@addTicket');//增加用户的票

//    分组
    $router->get('userGetCategory','CategoryController@userGetCategory');//用户获取分组列表

});
